package org.bee.tl.core;

import java.util.HashMap;
import java.util.Map;

public class TypeClass
{

	
	Class rawType = Object.class;
	Map<String, Class> ptypeMap = new HashMap<String, Class>(1);
	Object ref = null;

	public TypeClass()
	{

	}

	public TypeClass(Class rawType)
	{

		this.rawType = rawType;
	}

	public Class getRawType()
	{
		return rawType;
	}

	public void setRawType(Class rawType)
	{
		this.rawType = rawType;
	}

	public Map<String, Class> getPtypeMap()
	{
		return ptypeMap;
	}

	public void setPtypeMap(Map<String, Class> ptypeMap)
	{
		this.ptypeMap = ptypeMap;
	}

	public boolean isRawType()
	{
		return ptypeMap.size() == 0;
	}

	public Object getRef()
	{
		return ref;
	}

	public void setRef(Object ref)
	{
		this.ref = ref;
	}

	public boolean isPrimitive()
	{
		if (this.rawType.isPrimitive())
		{
			return true;
		}
		if (this.rawType.equals(Integer.class) || rawType.equals(Boolean.class) || rawType.equals(Double.class))
		{
			return true;
		}
		else
		{
			return false;
		}

	}

	public boolean equals(Object o)
	{
		TypeClass other = (TypeClass) o;
		if (this.rawType.equals(other.rawType))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}
